package com.ynwa.dp.singleton;

/**
 * @author gzd
 * @date 2018-10-22 下午10:19
 * @desc 比较好的实现方式
 */
public class Good {

    public static String abc = "111";

    private Good() {
        System.out.println("instance created ...");
    }

    private static class Holder{
        static {
            System.out.println("inner ...");
        }
        private static Good good = new Good();
    }

    public static Good getInstance(){
        return Holder.good;
    }

}
